package model;




/*Registers a contact

@param c the contact to register
@return true if registration ok, false otherwise */

public class Contact {
	protected String firstName;
	protected String lastName;
	protected String homeAddress;
	protected String companyAddress;
	protected String personalPhone;
	protected String homePage;
	protected String email;
	protected String photo;
	protected String group;
	
	
	public Contact(){
		this("","","","","","","","","");
	}
	public Contact(String firstName, String lastName, String homeAddress,
			String companyAddress, String personalPhone, String homePage,
			String email, String photo, String group) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.homeAddress = homeAddress;
		this.companyAddress = companyAddress;
		this.personalPhone = personalPhone;
		this.homePage = homePage;
		this.email = email;
		this.photo = photo;
		this.group = group;
	}

	

	public String getFirstName() {
		return firstName;
		/** Return the firstName of the contact
		 * 
		 */
	}


	public void setFirstName(String firstName) {
		this.firstName = firstName;
		/**
		 * 
		 */
	}


	public String getLastName() {
		return lastName;
	}


	public void setLastName(String lastName) {
		this.lastName = lastName;
	}


	public String getHomeAddress() {
		return homeAddress;
	}


	public void setHomeAddress(String homeAddress) {
		this.homeAddress = homeAddress;
	}


	public String getCompanyAddress() {
		return companyAddress;
	}


	public void setCompanyAddress(String companyAddress) {
		this.companyAddress = companyAddress;
	}


	public String getPersonalPhone() {
		return personalPhone;
	}


	public void setPersonalPhone(String personalPhone) {
		this.personalPhone = personalPhone;
	}


	public String getHomePage() {
		return homePage;
	}


	public void setHomePage(String homePage) {
		this.homePage = homePage;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getPhoto() {
		return photo;
	}


	public void setPhoto(String photo) {
		this.photo = photo;
	}
	
	public String getGroup() {
		return group;
	}


	public void setGroup(String group) {
		this.group = group;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((companyAddress == null) ? 0 : companyAddress.hashCode());
		result = prime * result + ((email == null) ? 0 : email.hashCode());
		result = prime * result
				+ ((firstName == null) ? 0 : firstName.hashCode());
		result = prime * result
				+ ((homeAddress == null) ? 0 : homeAddress.hashCode());
		result = prime * result
				+ ((homePage == null) ? 0 : homePage.hashCode());
		result = prime * result
				+ ((lastName == null) ? 0 : lastName.hashCode());
		result = prime * result
				+ ((personalPhone == null) ? 0 : personalPhone.hashCode());
		result = prime * result + ((photo == null) ? 0 : photo.hashCode());
		result = prime * result	+	((group == null) ? 0 : group.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Contact other = (Contact) obj;
		if (companyAddress == null) {
			if (other.companyAddress != null)
				return false;
		} else if (!companyAddress.equals(other.companyAddress))
			return false;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (homeAddress == null) {
			if (other.homeAddress != null)
				return false;
		} else if (!homeAddress.equals(other.homeAddress))
			return false;
		if (homePage == null) {
			if (other.homePage != null)
				return false;
		} else if (!homePage.equals(other.homePage))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		if (personalPhone == null) {
			if (other.personalPhone != null)
				return false;
		} else if (!personalPhone.equals(other.personalPhone))
			return false;
		if (photo == null) {
			if (other.photo != null)
				return false;
		} else if (!photo.equals(other.photo))
			return false;
		if (group == null) {
			if (other.group != null)
				return false;
		} else if (!group.equals(other.group))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return " [firstName=" + firstName + "\n lastName=" + lastName
				+ "\n homeAddress=" + homeAddress + "\n companyAddress="
				+ companyAddress + "\n personalPhone=" + personalPhone
				+ "\n homePage=" + homePage + "\n email=" + email + "\n photo="
				+ photo + "\n group =" + group +" ]";
	}
	
	
}